package org.fujene.structure;

public class LookupPointer implements Comparable<LookupPointer> {
	// public byte flags;
	public int block;
	public int point;
	public long firstID;

	public LookupPointer() {
		this.block = -1;
		this.point = -1;
	}

	public LookupPointer(int block, int point) {
		this(block, point, -1);
	}

	public LookupPointer(int block, int point, long ID) {
		this.block = block;
		this.point = point;
		this.firstID = ID;
	}
	
	public String toString() {
		return new String("(" + this.block + ", " + this.point + ") from "
				+ firstID);
	}

	public boolean equals(LookupPointer q) {
		if (q.block == this.block && q.point == this.point)
			return true;
		return false;
	}

	@Override
	public int compareTo(LookupPointer query) {
		if (query.block != this.block) {
			return this.block - query.block;
		} else {
			if (query.point != this.point) {
				return this.point - query.point;
			} else {
				return 0;
			}
		}
	}
}
